<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
    String path = request.getContextPath();
%>
<html>
    <head>
        <title>列表</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/zcms/jquery-1.6.1.min.js"></script>
        <script type='text/javascript' src='${pageContext.request.contextPath}/dwr/interface/CountryDAO.js'></script>
        <script type='text/javascript' src='${pageContext.request.contextPath}/dwr/interface/ProductDAO.js'></script>
        <script type='text/javascript' src='${pageContext.request.contextPath}/dwr/interface/DocumentTypeDAO.js'></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/zcms/zDialog.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/zcms/zDrag.js"></script>
        <script type='text/javascript' src='${pageContext.request.contextPath}/dwr/engine.js'></script>
        <script type='text/javascript' src='${pageContext.request.contextPath}/dwr/util.js'></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/cont_diqu.js"></script>
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/css.css" />
        <script language="javascript" type="text/javascript" src="${pageContext.request.contextPath}/document/j.js" ></script>
        <link href="${pageContext.request.contextPath}/css/cont.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript">
            ;function loadTop() {	
                var topframe = parent.frames.topFrame;
                topframe.location = "top.action";
            }
            function newD() {
                window.location= "add_input.action";
            }
            function del() {
                var msgs = "确认删除记录吗？";
                if (confirm(msgs) == true) {
                    return true;
                } else {
                    return false;
                }
            }
            
            function getDAO()
            {
                CountryDAO.findAll(callbackcountry);
                ProductDAO.findAll(callbackproduct);
                DocumentTypeDAO.findAll(callbackgroup);
               
           
            }
                      
            function callbackcountry(data){  
                dwr.util.removeAllOptions("country");
                dwr.util.addOptions("country",{'-1':'--请选择--'});
                dwr.util.addOptions("country",data,"id","name");  
                var a = "<s:property value="document.country.id" />";
       
                if (typeof(a) != "undefined") 
                {                      
                    dwr.util.setValue("country",a);  
                }  
 
            }
            function callbackproduct(data){ 
                dwr.util.removeAllOptions("products");
                dwr.util.addOptions("products",{'-1':'--请选择--'});
                dwr.util.addOptions("products",data,"id","name");  
                var a = "<s:property value="document.product.id" />";
       
                if (typeof(a) != "undefined") 
                {   
                   
                    dwr.util.setValue("products",a);  
                }  
            }
            
            function callbackgroup(data){  //显示出紧急度
                dwr.util.removeAllOptions("typeCode");
                dwr.util.addOptions("typeCode",{'-1':'--请选择--'});
                dwr.util.addOptions("typeCode",data,"id","name");  
                var a = "<s:property value="document.documentType.id" />";            
                if (typeof(a) != "undefined") 
                {                      
                    dwr.util.setValue("typeCode",a);                  
                }  
            }
            function del() {
                var msgs = "确认删除记录吗？";
                if (confirm(msgs) == true) {
                    return true;
                } else {
                    return false;
                }
            }
            
            function nav5(id){
                document.getElementById('text5').innerHTML= document.getElementById(id).innerHTML
                document.getElementById('document.productName').value= document.getElementById(id).innerHTML;
          
                document.getElementById('document.product.id').value=id;
                $("#cplb_big").css("display","none");
            };
            
        </script>


        <script type="text/javascript">
            $(document).ready(function(){
                $("#cplb_tab1").mouseover(function(){
                    $("#cplb_tab1").css("background","#D3E0F3");
                    $("#cplb_tab1").css("border-right","0");
                    $("#cplb_tab1").css("border-left","2px solid #F3BE18");
                    $("#cplb_tab1").css("border-top","2px solid #F3BE18");
                    $("#cplb_tab1").css("border-bottom","2px solid #F3BE18");
                    $("#cplb_nav1").css("display","block");
                    $("#cplb_nav2").css("display","none");
                    $("#cplb_nav3").css("display","none");
                    $("#cplb_tab2").css("background","#EAF1F7");
                    $("#cplb_tab2").css("border-top","0");
                    $("#cplb_tab2").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab2").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab3").css("background","#EAF1F7");
                    $("#cplb_tab3").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab3").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab3").css("border-top","0");
                });

                $("#cplb_tab2").mouseover(function(){
                    $("#cplb_tab2").css("background","#D3E0F3");
                    $("#cplb_tab2").css("border-right","0");
                    $("#cplb_tab2").css("border-left","2px solid #F3BE18");
                    $("#cplb_tab2").css("border-top","2px solid #F3BE18");
                    $("#cplb_tab2").css("border-bottom","2px solid #F3BE18");
                    $("#cplb_nav2").css("display","block");
                    $("#cplb_nav1").css("display","none");
                    $("#cplb_nav3").css("display","none");
                    $("#cplb_tab1").css("background","#EAF1F7");
                    $("#cplb_tab1").css("border-top","0");
                    $("#cplb_tab1").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab1").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab3").css("background","#EAF1F7");
                    $("#cplb_tab3").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab3").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab3").css("border-top","0");
                });

                $("#cplb_tab3").mouseover(function(){
                    $("#cplb_tab3").css("background","#D3E0F3");
                    $("#cplb_tab3").css("border-right","0");
                    $("#cplb_tab3").css("border-left","2px solid #F3BE18");
                    $("#cplb_tab3").css("border-top","2px solid #F3BE18");
                    $("#cplb_tab3").css("border-bottom","2px solid #F3BE18");
                    $("#cplb_nav3").css("display","block");
                    $("#cplb_nav1").css("display","none");
                    $("#cplb_nav2").css("display","none");
                    $("#cplb_tab2").css("background","#EAF1F7");
                    $("#cplb_tab2").css("border-top","0");
                    $("#cplb_tab2").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab2").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab1").css("background","#EAF1F7");
                    $("#cplb_tab1").css("border-right","2px solid #F3BE18");
                    $("#cplb_tab1").css("border-bottom","1px dotted #96A6BD");
                    $("#cplb_tab1").css("border-top","0");
                });

                $("#cplb_eav").mouseover(function(){
                    $("#cplb_big").css("display","block");
                });
                $("#cplb_eav").mouseout(function(){
                    $("#cplb_big").css("display","none");
                });
                $("#cplb_big").mouseover(function(){
                    $("#cplb_big").css("display","block");
                });
                $("#cplb_big").mouseout(function(){
                    $("#cplb_big").css("display","none");
                });
            });
        </script>
        <style>
            body,td,th{font-size:12px}
            .alllisttitle{ padding-left:10px}
            a:link,a:visited{ color:#000000; text-decoration:none}
            a:hover{ color:#ff0000; text-decoration:none}
            select{ background:#ffffff!important}
        </style>
        <!--国家js开始-->
        <script type="text/javascript">
            var menuids=["suckertree"]

            function buildsubmenus(){
                for (var i=0; i<menuids.length; i++){
                    var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
                    for (var t=0; t<ultags.length; t++){
                        ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
                        ultags[t].parentNode.onmouseover=function(){
                            this.getElementsByTagName("ul")[0].style.display="block"
                        }
                        ultags[t].parentNode.onmouseout=function(){
                            this.getElementsByTagName("ul")[0].style.display="none"
                        }
                    }
                }
            }

            if (window.addEventListener)
                window.addEventListener("load", buildsubmenus, false)
            else if (window.attachEvent)
                window.attachEvent("onload", buildsubmenus)
        </script>
        <script type="text/javascript">
            function nav(id){
                if(document.getElementById(id).innerHTML=="所有(清空条件)"){
                    document.getElementById('text').innerHTML="";
                    document.getElementById('document.country.id').value=-1;
                    document.getElementById('document.countryName').value="";
                    $(".suckertree_ul").css("display","none");
                }
                else{
                    document.getElementById('text').innerHTML= document.getElementById(id).innerHTML;
                    document.getElementById('document.country.id').value=id;
                    document.getElementById('document.countryName').value=document.getElementById(id).innerHTML;
                    $(".suckertree_ul").css("display","none");
                }
            };
        </script>
        <!--国家js结束-->

        <style type="text/css"> 
            *{ padding:0; margin:0; list-style-type:none;} 
            body{font-family: "宋体";font-size: 12px;} 
            #t_con1{ float:left;width:80px; line-height:25px; height:25px;color:#00F; cursor:pointer;border:1px #cccccc solid; text-align:center;} 
            #t_area1{ position:absolute;width:528px; overflow:hidden; border:3px #AAADA8 solid; background-color:#ffffff; top:25px; left:-452px;padding-bottom:10px;display:none; } 
            #t_area1 ul{} 
            #t_area1 li{ width:60px; height:25px; float:left; display:inline;  text-align:left!important; line-height:25px; margin:4px auto auto 5px; } 
            #t_area1 li a:link,#t_area1 li a:visited{ color:#444444; text-decoration:none; text-align:left!important} 
            #t_area1 li a:hover{ color:#ff0000; text-decoration:none; text-align:left!important} 

            #t_con2{ float:left;width:100px; line-height:25px; height:25px;color:#00F; cursor:pointer;border:1px #cccccc solid; text-align:center;} 
            #t_area2{ position:absolute;width:268px; overflow:hidden; border:2px #cccccc solid; background-color:#ffffff; top:20px; left:0;padding-bottom:10px;display:none; } 
            #t_area2 ul{} 
            #t_area2 li{ width:60px; height:18px; float:left; display:inline; text-align:center; line-height:25px; margin:4px auto auto 5px; } 
            #t_area2 li a:link,#t_area2 li a:visited{ color:#444444;text-decoration:none;} 
            #t_area2 li a:hover{ color:#ff0000; text-decoration:none;} 
        </style>
        <!--单证类别js开始-->
        <script type="text/javascript">
            //        var menuids2=["suckertree2"]
            //
            //        function buildsubmenus2(){
            //            for (var i=0; i<menuids2.length; i++){
            //                var ultags2=document.getElementById(menuids2[i]).getElementsByTagName("ul")
            //                for (var t=0; t<ultags2.length; t++){
            //                    ultags2[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
            //                    ultags2[t].parentNode.onmouseover=function(){
            //                        this.getElementsByTagName("ul")[0].style.display="block"
            //                    }
            //                    ultags2[t].parentNode.onmouseout=function(){
            //                        this.getElementsByTagName("ul")[0].style.display="none"
            //                    }
            //                }
            //            }
            //        }
            //
            //        if (window.addEventListener)
            //            window.addEventListener("load", buildsubmenus2, false)
            //        else if (window.attachEvent)
            //            window.attachEvent("onload", buildsubmenus2)
        </script>
        <script type="text/javascript">
            function nav2(id){
              
                if(document.getElementById(id).innerHTML=="所有(清空条件)"){
                    document.getElementById('text2').innerHTML="";
                    document.getElementById('document.documentType.id').innerHTML=-1;
                }
                else{
                    document.getElementById('text2').innerHTML= document.getElementById(id).innerHTML;
                    document.getElementById('document.documentType.id').value=id;
                    document.getElementById('document.productName').value= document.getElementById(id).innerHTML;
                }
            };
            
            
            function showarea1(){ 
                var con = document.getElementById("t_area1"); 
                var arealist = con.getElementsByTagName("li"); 
                var g = document.getElementById("t_con1") 
                con.style.display = "block"; 
                for (var i=0;i<arealist.length;i++){ 
                    arealist[i].onclick = function(){ 
                     
                        if(this.innerText=="所有(清空条件)")
                        {
                            document.getElementById("t_con1").innerText="";
                            document.getElementById('document.documentType.id').value=-1;
                            document.getElementById('document.typeName').value="";
                      
                        }
                        else{
                             g.innerText = this.innerText ; 
                            document.getElementById('document.typeName').value=this.innerText;
                            document.getElementById('document.documentType.id').value=this.id;
                        }
                    
                           

                        con.style.display = "none"; 
                    } 
                } 
            } 
            function offarea1(){ 
                var con = document.getElementById("t_area1"); 
                con.style.display = "none"; 
            } 
            var timer1; 
        </script>
        <!--单证类别js结束-->
    </head>

    <body onLoad="getDAO()">

        <table width="99%" border="0" cellspacing="1" align="center"
               bgcolor="#b5d6e6">
            <s:form action="list" method='post' theme="simple" name="form" namespace="/document">
                <s:hidden id="page" name="page"></s:hidden>
                <s:hidden id="pageSize" name="pageSize"></s:hidden>
                <s:hidden id="document.country.id" name="document.country.id" />
                <s:hidden id="document.countryName" name="document.countryName" />
                <s:hidden id="document.product.id" name="document.product.id" value="-1" />
                <s:hidden id="document.productName" name="document.productName" />
                <s:hidden id="document.documentType.id" name="document.documentType.id"  value="-1" />
                <s:hidden id="document.typeName" name="document.typeName" />
                <tr>
                    <td height="22" colspan="7" align="left"
                        background="../images/main20100521_58.gif" class="alllisttitle">
                        单证格式搜索
                    </td>
                </tr>
                <tr>
                    <td width="8%" style="background:#DEEBF1; text-align:center">单证格式名称：</td>
                    <td width="11%" bgcolor="#FFFFFF">
                        <input style="width:100%" id="document.name" name="document.name"/>
                    </td>			
                    <td width="6%" style="background:#DEEBF1; text-align:center"> 采购国： </td>
                    <td width="13%" bgcolor="#FFFFFF">
                        <!--国家开始-->
                        <div class="suckerdiv">
                            <ul id="suckertree">
                                <li class="suckerdiv_li"><a href="#" id="text" style="padding:4px 0 2px 5px;height:26px;border:1px solid #cccccc;"><s:property value="document.countryName"/></a>
                                    <ul class="suckertree_ul" style=";z-index:0">
                                        <li class="suckertree_ul_li" style="z-index:9999"><a href="#" style="z-index:9999;width:398px;" id="font9999" onClick="nav('font9999')">所有(清空条件)</a>
                                            <s:iterator value="clist" var="c" status="u">
                                            <li class="suckertree_ul_li" style="z-index:-${u.index}"><a href="#" style="z-index:-${u.index}" id="${c.id}" onClick="nav('${c.id}')">${c.name}</a>
                                                <s:if test="#c.list!=null">
                                                    <ul>
                                                        <s:iterator value="#c.list" var="c2" status="uu">
                                                            <li><a href="#" id="${c2.id}" onClick="nav('${c2.id}')">${c2.name}</a></li>
                                                        </s:iterator>


                                                    </ul> 
                                                </s:if>
                                            </li>
                                        </s:iterator>

                                    </ul>
                                </li>
                            </ul>
                        </div>
                        <!--国家结束-->
                    </td>
                    <td width="6%" style="background:#DEEBF1; text-align:center">产品：</td>
                    <td width="14%" style="position:relative;height:25px">
                        <div style="float:left; width:80px; height:20px; border:1px solid #cccccc;padding:4px 0 2px 5px; background:#ffffff" id="cplb_eav"><span style=" float:left;width:70px; height:20px; background:url(../images/jiansuo_bg.jpg) no-repeat right; padding:0 7px 0 3px;cursor:hand;" id="text5">${document.productName}</span></div>
                        <table width="700" style="border:1px solid #ADCAF2;display:none; position:absolute; background:#ffffff;top:27px;left:-200px;" cellpadding="0" cellspacing="0" id="cplb_big">
                            <tr>
                                <td valign="top" style="border-right:1px solid #F2BC14;"><table border="0" cellpadding="0" cellspacing="0" style="width:35px; margin-right:-6px">
                                        <s:iterator value="proList" var="p" status="u">
                                            <tr>
                                                <td height="80px" class="cplb_tab_link" id="cplb_tab${u.index+1}">${p.name}</td>
                                            </tr>
                                        </s:iterator>

                                    </table>
                                </td>
                                <td width="965" valign="top" class="cplb_td"><!--工业品-->
                                    <s:iterator value="proList" var="p" status="u">

                                        <s:if test="#u.first" >
                                            <table width="100%" border="0" cellspacing="15" cellpadding="0" class="cplb_table" id="cplb_nav${u.index+1}">
                                            </s:if>
                                            <s:else>
                                                <table width="100%" border="0" cellspacing="15" cellpadding="0" class="cplb_table" id="cplb_nav${u.index+1}" style="display:none">
                                                </s:else>
                                                <s:iterator value="#p.produceObjlist" var="p1" status="p3">
                                                    <tr> 
                                                        <td width="33%">
                                                            <table width="100%" border="0" cellspacing="0" cellpadding="0" style=" background:url(images/cplb_bg.jpg) repeat-x top">
                                                                <tr>
                                                                    <td style="padding:0 5px 0 5px;"><strong><a href="#" id="${p1.id}" onClick="nav5('${p1.id}')">${p1.name}</a></strong></td>
                                                                </tr>
                                                                <tr>
                                                                    <td style="padding:0 5px 0 5px;">
                                                                        <s:iterator value="#p1.produceObjlist" var="p2" status="p2sta">
                                                                            <a href="#" id="${p2.id}" onClick="nav5('${p2.id}')">${p2.name}</a><s:if test="#p2sta.last"> </s:if>
                                                                            <s:else>|</s:else> 
                                                                        </s:iterator>
                                                                    </td>  
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>  </s:iterator>
                                                </table>

                                        </s:iterator>

                                </td>
                            </tr>
                        </table>
                    </td>
                    <td width="6%" style="background:#DEEBF1; text-align:center"> 单证类型：</td>
                    <td width="12%" bgcolor="#FFFFFF">
                        <div style="position:relative; float:left; width:80px; height:25px; margin-top:3px; background:#ffffff">
                            <div id="t_con1" style="background:url(../images/jiansuo_bg.jpg) no-repeat right;color:#444444; height:23px; line-height:23px" onMouseOver="showarea1();clearTimeout(timer1)" onMouseOut="timer1=setTimeout('offarea1()',200);">${document.typeName}</div> 
                            <div id="t_area1" onMouseOver="showarea1()" onMouseOut="offarea1();clearTimeout(timer1)"> 
                                <ul> 
                                    <li style="height:auto;width:528px"><a href="#">所有(清空条件)</a></li> 

                                </ul> 
                                <s:iterator value="typeList" var="t" status="u">
                                    <ul> 
                                        <li style="height:auto" id="${t.id}"><a href="#">${t.name}</a></li> 

                                    </ul> 
                                </s:iterator>
                            </div> 
                        </div>
                    </td>
                    <td width="7%" bgcolor="#DEEBF1" onClick="document.form.submit()" style="cursor: hand;">
                        <img src="<%=path%>/images/lb_select_anniu.jpg"/>
                    </td>
                </tr>
            </s:form>
        </table>
        <table width="99%" border="0" align="center" cellpadding="0"
               cellspacing="0">
            <tr>
                <td height="30" align="right">

                    <table width="60" border="0" cellpadding="0" cellspacing="0"
                           background="../images/addnew002.gif">
                        <tr  onClick="newD();" style="cursor: hand;">
                            <td>
                                <img src="../images/addnew001.gif">
                            </td>
                            <td nowrap>
                                新建单证格式
                            </td>
                            <td align="right">
                                <img src="../images/addnew003.gif">
                            </td>
                        </tr>

                    </table>
            </tr>
        </table>
        <table width="99%" border="0" align="center" cellpadding="0"
               cellspacing="1" bgcolor="#b5d6e6">
            <tr>
                <td height="22" colspan="7" align="left"
                    background="../images/main20100521_58.gif" class="alllisttitle">
                    单证格式列表
                </td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td height="22" align="center"
                    background="../images/main20100521_58.gif" class="alllisttitle">
                    序号
                </td>
                <td height="22" align="center"
                    background="../images/main20100521_58.gif" class="alllisttitle">
                    单证格式编码
                </td>
                <td align="center" background="../images/main20100521_58.gif"
                    class="alllisttitle">
                    单证格式名称
                </td>
                <td align="center" background="../images/main20100521_58.gif"
                    class="alllisttitle">
                    所属单证类型
                </td>

                <td align="center" background="../images/main20100521_58.gif"
                    class="alllisttitle">
                    适用产品
                </td>

                <td align="center" background="../images/main20100521_58.gif"
                    class="alllisttitle">
                    采购国
                </td>            
                <td align="center" background="../images/main20100521_58.gif"
                    class="alllisttitle">
                    填制要点
                </td>
                <td align="center" background="../images/main20100521_58.gif"
                    class="alllisttitle">
                    查看
                </td>
                <td align="center" background="../images/main20100521_58.gif"
                    class="alllisttitle">
                    修改</td>
                <td align="center" background="../images/main20100521_58.gif"
                    class="alllisttitle">删除</td>

            </tr>
            <s:iterator value="pageBean.list" var="dc" status="stat">
                <tr bgcolor="#FFFFFF" onMouseOver="this.bgColor='#e3f0f7'"
                    onMouseOut="this.bgColor='#FFFFFF'">
                    <td height="19" align="left" class="zczb_qua">
                        ${stat.index+1}
                    </td>
                    <td align="left" class="zczb_qua">
                        ${code}
                    </td>
                    <td align="left" class="zczb_qua">
                        ${name}
                    </td>
                    <td align="left" class="zczb_qua">
                        ${typeName}
                    </td>
                    <td align="left" class="zczb_qua">
                        ${productName}
                    </td>
                    <td align="left" class="zczb_qua">
                        ${countryName}
                    </td>                   

                    <td align="center"><a href="fillPoints.action?document_id=${id}">新增及查看</a></td>
                    <td align="center"><a href="#"
                                          onclick="window.open('show.action?document_id=${id}&pid=${pid}&page=${page}','newwindow','height=800, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no');">查看</a> 
                    </td>

                    <td align="center"><a href="updateInput.action?document_id=${id}&page=${page}&pid=${pid}">
                            <img src="../images/img3.gif" border="0"/></a></td>

                    <td align="center"><a href="delete.action?document_id=${id}&page=${page}&pid=${pid}"
                                          onclick="javascript:return del()"><img src="../images/img2.gif" border="0"/></a></td>

                </tr>
            </s:iterator>
        </table>
        <s:include value="/common/page.jsp"/>
    </body>
</html>
